package com.example.demo.controller;

import com.example.demo.entity.User;
import com.example.demo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

@Controller
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;


    //ResponseBody表示返回对象对应的json数据，RequestMapping表示请求的路径
    @RequestMapping("/alluser")
    @ResponseBody
    public List<User> getUserList(){

        return userService.getUserList();
    }
}
